home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_07
/
9n07106a
< prev
next >
Wrap
Text File
|
1991-05-26
|
789b
|
52 lines
/* all_true.c */
/* ---------- */
/*
No matter what code the calling program returns, this
program will always return 0 (success).
Usage: all_true program args
Example: all_true sleep 5
*/
#include <stdio.h>
#include <signal.h>
#define RET_VALUE 0
main(argc,argv)
int argc;
char **argv;
{
process(argc,argv);
exit(RET_VALUE);
}
process(argc,argv)
int argc;
char **argv;
{
int pid;
if ((pid = fork()) == -1)
{
perror("all_true");
exit(1);
}
if (pid > 0 )
{
signal(SIGINT,SIG_IGN); /* Ignore interrupt key */
while (wait( (int *) 0 ) == pid);
return;
}
signal(SIGINT,SIG_DFL); /* Default interrupt key */
argv++; /* Point to program argument */
execvp(*argv, argv);
perror("all_true");
}